package com.kotlin.myapplicationd.activity;

import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.kotlin.myapplicationd.R;
import com.kotlin.myapplicationd.base.BaseActivity;
import com.kotlin.myapplicationd.tools.ToolAlert;
import com.kotlin.network.bean.LoginBean;
import com.kotlin.network.model.INormalData;

/**
 * Created by dong.xu on 2017/6/1.
 */

public class LoginKotlinActivity extends BaseActivity{
    @Override
    public int bindLayout() {
        return R.layout.activity_login;
    }


    private void login(String strUsername, String strPassword) {

        getGlobalCommonPresenter().login(strUsername, strPassword, new INormalData<LoginBean>() {
            @Override
            public void load(LoginBean data) {

            }

            @Override
            public void error(String errmsg, int code) {


            }
        },true);


    }


    @Override
    public void initParams(Bundle params) {

    }

    @Override
    public void initView(View view) {

    }

    @Override
    public void initListener() {

    }

    @Override
    public void doBusiness(Context mContext) {
        //login("18550009543","123456");
        sum(33,0.05,15);
    }

    @Override
    public void resume() {

    }

    @Override
    public void destroy() {

    }

    /**
     * DCF估值
     * @param C 第i年现金流 单位 亿元
     * @param r 贴现率
     * @param year 年限
     */
    private void sum(int C,double r,int year)
    {
        double sum=0;
        for(int i = 1;i<=year;i++)
        {
            //Math.pow(1.05,i);
            sum = sum + C/Math.pow(1+r,i);
        }

        ToolAlert.toastLong(String.valueOf(sum));

    }



}
